/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package load.util;

import core.ConnectException;
import core.InPort;
import core.StdNode;
import core.TriggerPort;

/**
 *
 * @author Jelle
 */
public class Watcher extends StdNode {
    private String _value;
    private InPort content = new InPort(java.lang.Object.class);
    private TriggerPort watch = new TriggerPort() {

        @Override
        protected void callInternal() {
            setValue(content.getValue() + "");
        }
    };

    public Watcher() {
        try {
            _value = content.getValue() + "";
        } catch (Exception e) {
            // ignore
        }

        this.autoPutPorts();
    }

    public void setValue(String x) throws ConnectException {
        this._value = x;
    }

    /**
     * @return the _value
     */
    public String getValue() {
        return _value;
    }
}
